//app.js
App({
  onLaunch: function () { 

  },

  onReady:function() {
     
  },

  

  //通用用的异步域名
  getUrl:function(){
    var Urlcom ='http://jbc.com';
    return Urlcom;
  },
  //第一种底部    
  editTabBar: function () {
    //使用getCurrentPages可以获取当前加载中所有的页面对象的一个数组，数组最后一个就是当前页面。     
    var curPageArr = getCurrentPages();    //获取加载的页面    
    var curPage = curPageArr[curPageArr.length - 1];    //获取当前页面的对象    
    var pagePath = curPage.route;    //当前页面url    
    if (pagePath.indexOf('/') != 0) { pagePath = '/' + pagePath; }
    var tabBar = this.globalData.tabBar;
    for (var i = 0; i < tabBar.list.length; i++) {
      tabBar.list[i].active = false;
      if (tabBar.list[i].pagePath == pagePath) {
        tabBar.list[i].active = true;    //根据页面地址设置当前页面状态          
      }
    }
    curPage.setData({ tabBar: tabBar });

  },



  globalData: {
    //第一种底部导航栏显示    
    tabBar: {
      "color": "#444",
      "backgroundColor": "#fff",
      "selectedColor": "#eb0000",
      "list": [
        {
          "pagePath": "/view/join/join",
          "text": "首页",
          "iconPath": "http://phtvvz9br.bkt.clouddn.com/foot_1.png",
          "selectedIconPath": "http://phtvvz9br.bkt.clouddn.com/foot1.png",
          "clas": "menu-item",
          "selectedColor": "#eb0000",
          active: true
        },
        {
          "pagePath": "/view/car/car",
          "text": "选车",
          "iconPath": "http://phtvvz9br.bkt.clouddn.com/foot_2.png",
          "selectedIconPath": "http://phtvvz9br.bkt.clouddn.com/foot2.png",
          "selectedColor": "#eb0000",
          "clas": "menu-item",
          active: false
        },
        {
          "pagePath": "/view/help/help",
          "text": "订单",
          "iconPath": "http://phtvvz9br.bkt.clouddn.com/foot_3.png",
          "selectedIconPath": "http://phtvvz9br.bkt.clouddn.com/foot3.png",
          "selectedColor": "#eb0000",
          "clas": "menu-item",
          active: false
        },
        {
          "pagePath": "/view/customer/customer",
          "text": "我的",
          "iconPath": "http://phtvvz9br.bkt.clouddn.com/foot_4.png",
          "selectedIconPath": "http://phtvvz9br.bkt.clouddn.com/foot4.png",
          "selectedColor": "#eb0000",
          "clas": "menu-item",
          active: false
        }
      ],
      "position": "bottom",
      
    },
    
  }
})  
